package home_4_15_jie_computer;

public class Computer  {
//    1.定义3个属性  computer com=new computer

//    2.数组

    Function [] functions=new Function[3];


    public void add(Function moi)
    {
for(int i=0;i<functions.length;i++)
{
    if(functions[i]==null)
    {
        functions[i]=moi;
        break;
    }

}
    }

    public void on() {
  for(int i=0;i<functions.length;i++)
  {
      functions[i].open();
  }
        System.out.println("计算机开机成功");




    }

    public void off() {
        for(int i=0;i<functions.length;i++)
        {
            functions[i].close();
        }
        System.out.println("计算机已经关机成功");

    }
}
